package fei.zhou.springboot4.demo2;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 描述该类- JPA
 *
 * @author zhoufei
 * @class: DemoService
 * @date 2021/1/20 11:42
 * @Verson 1.0 -2021/1/20 11:42
 * @see
 */

@Service
public class DemoServiceImpl implements DemoService {
    
    @Async // 1声明方法为异步方法
    @Override
    public void asyncTask1(Integer i) {
        try {
            //间隔1秒
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("执行异步任务A: " + i);
    }
    
}